<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/pages/inc/taglibs.jsp" %>
<%@ include file="/WEB-INF/pages/inc/nocache.jsp" %>
<%@ taglib uri="http://www.springmodules.org/tags/commons-validator" prefix="validator" %>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>用户登录</title>
    <meta http-equiv="Cache-Control" content="max-age=0"/>
    <%@ include file="/WEB-INF/pages/inc/meta.jsp" %>
    <%--<meta name="decorator" content="${theme}.index">--%>
    <link rel="stylesheet" type="text/css" href="/themes/default/css/style.css"/>
    <script type="text/javascript" src="/js/funkyUI/jquery.funkyUI.js"></script>
    <script type="text/javascript" src="/js/lhgdialog/lhgdialog.min.js"></script>
    <validator:javascript formName="loginCommand" staticJavascript="false" xhtml="true" cdata="false"/>
    <script type="text/javascript">
        function openDlg(id)
        {
            var dg = new $.dialog({ id:id,
                iconTitle:false,
                title:'新用户注册',
                maxBtn:false,
                autoSize:true,
                drag:false,
                btnBar:false,
                cover:true,
                width:600,
                height:400,
                page:'${ctx}/sale/saleRegist.aspx' });
            dg.ShowDialog();
        }


    </script>
    <%--<script type="text/javascript">--%>
        <%--$(document).ready(function() {--%>
            <%--// 图片验证码显示   ********begin--%>
            <%--$("#validate_text").focus(function() {--%>
                <%--$("#validate_image").css("left", $(this).position().left - $("#validate_image").width() / 2);--%>
                <%--$("#validate_image").css("top", $(this).position().top - 50);--%>
                <%--$("#validate_image").find("img").attr("src", "/validate.png?" + Math.random());--%>
                <%--$("#validate_image").show();--%>
            <%--});--%>
            <%--$("#validate_text").blur(function() {--%>
                <%--$("#validate_image").hide();--%>
            <%--});--%>
            <%--// 图片验证码显示   ********end--%>
        <%--});--%>
    <%--</script>--%>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#validatecode").click(function() {
                $(this).attr("src", "/validate.png?" + Math.random());
                $("#validatecode2").attr("src", $(this).attr("src"));
            });
            // 图片验证码显示   ********end
        });
    </script>

    <script type="text/javascript">
        $(document).ready(function() {
            $("#username").focus();
            if ($("#username").val() != '') {
                $("#login_password").focus();
            }
        <c:if test="${not empty error}">
            alert("${error}");
            var error = $("#errorContent").val();
            if (error.substring(0, 4) == "验证码错") {
                $("#validate_text").focus();
            } else if (error.substring(0, 4) == "密码错误") {
                $("#login_password").focus();
            } else {
                $("#username").focus();
            }
        </c:if>

        });
    </script>

</head>
<body>
<input type="hidden" id="errorContent" value="${error}"/>

<%--<div id="content_center">--%>
    <%--<div class="maincontent">--%>
        <div id="top"></div>
        <form action="${ctx}/login.aspx" method="post" onsubmit="return validateLoginCommand(this);" id="loginForm">
            <%--<ul>--%>
                <%--<li class="content_center_left"></li>--%>
                <%--<li class="content_center_mid">--%>
                    <%--<ul>--%>
                        <%--<li class="login_center_icon"><img src="/themes/default/images/login_07.gif" alt="登录"/></li>--%>
                        <%--<li class="login_center_welcome"><img src="/themes/default/images/login_10.gif" alt="欢迎登录"/>--%>
                        <%--</li>--%>
                        <%--<li class="login_center_title">用户名：</li>--%>
                        <%--<li class="login_center_text">--%>
                            <%--<label><input name="username" id="username" type="text" value="${username}" maxlength="50"/></label>--%>
                        <%--</li>--%>
                        <%--<li class="login_center_title">密码：</li>--%>
                        <%--<li class="login_center_text">--%>
                            <%--<label><input id="login_password" name="password" type="password" value="${password}"--%>
                                          <%--maxlength="30"/></label>--%>
                        <%--</li>--%>
                        <%--<li class="login_center_title">验证码：</li>--%>
                        <%--<li class="login_center_text_imgcode">--%>
                            <%--<label><input name="validatecode" type="text" maxlength="4" id="validate_text"/></label>--%>
                        <%--</li>--%>
                        <%--<li class="login_center_login_button">--%>
                            <%--<label><input type="image" src="/themes/default/images/login_14.gif"/></label>--%>
                        <%--</li>--%>
                    <%--</ul>--%>
                <%--</li>--%>
                <%--<li class="content_center_right"></li>--%>
            <%--</ul>--%>
            <div id="center">
        <div id="center_left"></div>
        <div id="center_middle">
            <div class="user">

                    <label class="userLabel">用户名：</label>
                        <input type="text" name="username" value="<c:out value='${username}'/>" maxlength="50" id="username"/>
                        <%--<span style="font-size: 12px;">&nbsp;* </span>--%>

            </div>
            <div class="user">

                    <label class="userLabel">密　码：</label><input type="password" name="password" value="<c:out value='${password}'/>"
                                       maxlength="50" id="login_password"/>
                        <%--<span style="font-size: 12px;">&nbsp;* </span>--%>

            </div>
            <div class="chknumber">
                <label class="userLabel">验证码：</label>
                    <input name="validatecode" type="text" maxlength="4" id="validate_text"
                           class="chknumber_input"/>
                <img src="/validate.png" width="55" height="20" id="validatecode" alt="图片验证码，点击图片更新" />
                <%--图片验证码，点击图片更新--%>
            </div>
        </div>
        <div id="center_middle_right"></div>
        <div id="center_submit">
            <div class="button" onclick="javascript:document.loginCommand.submit()"> <input type="submit" value="" id="submit" /></div>
            <div class="button" onclick="openDlg(0)"> <input type="button" value="" id= "register" /></div>
            <%--<div class="button" onclick="javascript:document.loginCommand.reset()"> <input type="reset" value="" id="reset" /></div>--%>
        </div>
        <div id="center_right"></div>
    </div>
        </form>

        <%--<div id="validate_image">--%>
            <%--<img src="/themes/default/images/spacer.gif" id="validatecode" alt="图片验证码，点击图片更新"/>--%>
        <%--</div>--%>
        <%--<a href="javascript:" onclick="openDlg(0)">注册</a>--%>
    <%--</div>--%>
<%--</div>--%>
<%--<br/>--%>
<div id="footer" align="center" style="color: orange;"><br/><br/>
    <spring:bind path="loginCommand.*">
        <span style="color:orange;"><c:out value="${status.errorMessage}"/></span>
    </spring:bind>
    <c:if test="${not empty error}">
        <span style="color:orange;">${error}</span>
    </c:if>
</div>

</body>
</html>


